picture: Add content-fit property
authorMarco Melorio <marco.melorio@protonmail.com>
Fri, 15 Jul 2022 16:18:26 +0000 (18:18 +0200)
committerMarco Melorio <marco.melorio@protonmail.com>
Fri, 15 Jul 2022 21:01:23 +0000 (23:01 +0200)
It allows to specify the resize mode of the paintable inside the
GtkPicture allocation. This also deprecates the keep-aspect-ratio
property.

Fixes #5027.

26 files changed:
demos/gtk-demo/sliding_puzzle.c
demos/node-editor/node-editor-window.ui
demos/widget-factory/widget-factory.ui
gtk/gtkenums.h
gtk/gtkpicture.c
gtk/gtkpicture.h
testsuite/reftests/center-center-100x100-picture-in-100x200-overlay.ui
testsuite/reftests/center-center-100x100-picture-in-100x200.ui
testsuite/reftests/center-center-100x100-picture-in-200x100-overlay.ui
testsuite/reftests/center-center-100x100-picture-in-200x100.ui
testsuite/reftests/center-center-150x150-picture-in-100x200-overlay.ui
testsuite/reftests/center-center-150x150-picture-in-100x200.ui
testsuite/reftests/center-center-150x150-picture-in-200x100-overlay.ui
testsuite/reftests/center-center-150x150-picture-in-200x100.ui
testsuite/reftests/center-center-200x200-picture-in-100x200-overlay.ui
testsuite/reftests/center-center-200x200-picture-in-100x200.ui
testsuite/reftests/center-center-200x200-picture-in-200x100-overlay.ui
testsuite/reftests/center-center-200x200-picture-in-200x100.ui
testsuite/reftests/center-center-20x20-picture-in-100x200-overlay.ui
testsuite/reftests/center-center-20x20-picture-in-100x200.ui
testsuite/reftests/center-center-20x20-picture-in-200x100-overlay.ui
testsuite/reftests/center-center-20x20-picture-in-200x100.ui
testsuite/reftests/center-center-300x300-picture-in-100x200-overlay.ui
testsuite/reftests/center-center-300x300-picture-in-100x200.ui
testsuite/reftests/center-center-300x300-picture-in-200x100-overlay.ui
testsuite/reftests/center-center-300x300-picture-in-200x100.ui

index 1af4e2b48a5cb26aa71478156ac74798d7296e68..b65bc428fbc9da5bc692c1e2bda910ac50be991b 100644 (file)
@@ -330,7 +330,7 @@ start_puzzle (GdkPaintable *paintable)
                                           x, y,
                                           width, height);
           picture = gtk_picture_new_for_paintable (piece);
-          gtk_picture_set_keep_aspect_ratio (GTK_PICTURE (picture), FALSE);
+          gtk_picture_set_content_fit (GTK_PICTURE (picture), GTK_CONTENT_FIT_FILL);
           gtk_grid_attach (GTK_GRID (grid),
                            picture,
                            x, y,
index 74c87ce8e7390dc979a768cbe0354c167cec31b4..34d4452a4a35d8362a609ba5a9c0284744b8756a 100644 (file)
                     <child>
                       <object class="GtkPicture" id="picture">
                         <property name="can-shrink">0</property>
-                        <property name="keep-aspect-ratio">1</property>
                         <property name="halign">center</property>
                         <property name="valign">center</property>
                         <child>
index 2963266e2a5d24e54573c3c19f375f1992089459..015ff4c79118e33b289649752ba439b6fce604ee 100644 (file)
@@ -1265,6 +1265,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
                                 <property name="child">
                                   <object class="GtkPicture">
                                     <property name="file">resource:///org/gtk/WidgetFactory4/sunset.jpg</property>
+                                    <property name="content-fit">cover</property>
+                                    <property name="overflow">hidden</property>
                                     <child>
                                       <object class="GtkDragSource">
                                         <signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
index 29c703762fbd1a56e8159500a07851a876ba065d..44e246fc9e607872bd7551ed61072db29e2950ac 100644 (file)
@@ -110,6 +110,36 @@ typedef enum
   GTK_BASELINE_POSITION_BOTTOM
 } GtkBaselinePosition;
 
+/**
+ * GtkContentFit:
+ * @GTK_CONTENT_FIT_FILL: Make the content fill the entire allocation,
+ *   without taking its aspect ratio in consideration. The resulting
+ *   content will appear as stretched if its aspect ratio is different
+ *   from the allocation aspect ratio.
+ * @GTK_CONTENT_FIT_CONTAIN: Scale the content to fit the allocation,
+ *   while taking its aspect ratio in consideration. The resulting
+ *   content will appear as letterboxed if its aspect ratio is different
+ *   from the allocation aspect ratio.
+ * @GTK_CONTENT_FIT_COVER: Cover the entire allocation, while taking
+ *   the content aspect ratio in consideration. This can result in an overflow
+ *   if the content aspect ratio is different from the allocation aspect ratio.
+ *   For this reason, you may also want to set [property@Gtk.Widget:overflow]
+ *   to %GTK_OVERFLOW_HIDDEN.
+ * @GTK_CONTENT_FIT_SCALE_DOWN: The content is scaled down to fit the
+ *   allocation, if needed, otherwise its original size is used.
+ *
+ * Controls how a content should be made to fit inside an allocation.
+ *
+ * Since: 4.8
+ */
+typedef enum
+{
+  GTK_CONTENT_FIT_FILL,
+  GTK_CONTENT_FIT_CONTAIN,
+  GTK_CONTENT_FIT_COVER,
+  GTK_CONTENT_FIT_SCALE_DOWN,
+} GtkContentFit;
+
 /**
  * GtkDeleteType:
  * @GTK_DELETE_CHARS: Delete characters.
index 0712d1844facec8070ead70daaf3bbb71f5de796..eaabda7c74cf0e5860dc91a13c8458b332963d04 100644 (file)
@@ -27,6 +27,7 @@
 #include "gtkintl.h"
 #include "gtkprivate.h"
 #include "gtksnapshot.h"
+#include "gtktypebuiltins.h"
 #include "gtkwidgetprivate.h"
 #include "gdkpixbufutilsprivate.h"
 
@@ -89,6 +90,7 @@ enum
   PROP_ALTERNATIVE_TEXT,
   PROP_KEEP_ASPECT_RATIO,
   PROP_CAN_SHRINK,
+  PROP_CONTENT_FIT,
   NUM_PROPERTIES
 };
 
@@ -100,8 +102,8 @@ struct _GtkPicture
   GFile *file;
 
   char *alternative_text;
-  guint keep_aspect_ratio : 1;
   guint can_shrink : 1;
+  GtkContentFit content_fit;
 };
 
 struct _GtkPictureClass
@@ -129,23 +131,47 @@ gtk_picture_snapshot (GtkWidget   *widget,
   height = gtk_widget_get_height (widget);
   ratio = gdk_paintable_get_intrinsic_aspect_ratio (self->paintable);
 
-  if (!self->keep_aspect_ratio || ratio == 0)
+  if (self->content_fit == GTK_CONTENT_FIT_FILL || ratio == 0)
     {
       gdk_paintable_snapshot (self->paintable, snapshot, width, height);
     }
   else
     {
       double picture_ratio = (double) width / height;
+      int paintable_width = gdk_paintable_get_intrinsic_width (self->paintable);
+      int paintable_height = gdk_paintable_get_intrinsic_height (self->paintable);
 
-      if (ratio > picture_ratio)
+      if (self->content_fit == GTK_CONTENT_FIT_SCALE_DOWN &&
+          width >= paintable_width && height >= paintable_height)
         {
-          w = width;
-          h = width / ratio;
+          w = paintable_width;
+          h = paintable_height;
+        }
+      else if (ratio > picture_ratio)
+        {
+          if (self->content_fit == GTK_CONTENT_FIT_COVER)
+            {
+              w = height * ratio;
+              h = height;
+            }
+          else
+            {
+              w = width;
+              h = width / ratio;
+            }
         }
       else
         {
-          w = height * ratio;
-          h = height;
+          if (self->content_fit == GTK_CONTENT_FIT_COVER)
+            {
+              w = width;
+              h = width / ratio;
+            }
+          else
+            {
+              w = height * ratio;
+              h = height;
+            }
         }
 
       x = (width - ceil (w)) / 2;
@@ -246,13 +272,19 @@ gtk_picture_set_property (GObject      *object,
       break;
 
     case PROP_KEEP_ASPECT_RATIO:
+      G_GNUC_BEGIN_IGNORE_DEPRECATIONS
       gtk_picture_set_keep_aspect_ratio (self, g_value_get_boolean (value));
+      G_GNUC_END_IGNORE_DEPRECATIONS
       break;
 
     case PROP_CAN_SHRINK:
       gtk_picture_set_can_shrink (self, g_value_get_boolean (value));
       break;
 
+    case PROP_CONTENT_FIT:
+      gtk_picture_set_content_fit (self, g_value_get_enum (value));
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -282,13 +314,19 @@ gtk_picture_get_property (GObject     *object,
       break;
 
     case PROP_KEEP_ASPECT_RATIO:
-      g_value_set_boolean (value, self->keep_aspect_ratio);
+      G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+      g_value_set_boolean (value, gtk_picture_get_keep_aspect_ratio (self));
+      G_GNUC_END_IGNORE_DEPRECATIONS
       break;
 
     case PROP_CAN_SHRINK:
       g_value_set_boolean (value, self->can_shrink);
       break;
 
+    case PROP_CONTENT_FIT:
+      g_value_set_enum (value, self->content_fit);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -394,11 +432,15 @@ gtk_picture_class_init (GtkPictureClass *class)
    *
    * Whether the GtkPicture will render its contents trying to preserve the aspect
    * ratio.
+   *
+   * Deprecated: 4.8: Use [property@Gtk.Picture:content-fit] instead.
    */
   properties[PROP_KEEP_ASPECT_RATIO] =
       g_param_spec_boolean ("keep-aspect-ratio", NULL, NULL,
                             TRUE,
-                            GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
+                            GTK_PARAM_READWRITE |
+                            G_PARAM_EXPLICIT_NOTIFY |
+                            G_PARAM_DEPRECATED);
 
   /**
    * GtkPicture:can-shrink: (attributes org.gtk.Property.get=gtk_picture_get_can_shrink org.gtk.Property.set=gtk_picture_set_can_shrink)
@@ -410,6 +452,17 @@ gtk_picture_class_init (GtkPictureClass *class)
                             TRUE,
                             GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
 
+  /**
+   * GtkPicture:content-fit: (attributes org.gtk.Property.get=gtk_picture_get_content_fit org.gtk.Property.set=gtk_picture_set_content_fit)
+   *
+   * How the content should be resized to fit inside the `GtkPicture`.
+   */
+  properties[PROP_CONTENT_FIT] =
+      g_param_spec_enum ("content-fit", NULL, NULL,
+                         GTK_TYPE_CONTENT_FIT,
+                         GTK_CONTENT_FIT_CONTAIN,
+                         GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
+
   g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
 
   gtk_widget_class_set_css_name (widget_class, I_("picture"));
@@ -420,7 +473,7 @@ static void
 gtk_picture_init (GtkPicture *self)
 {
   self->can_shrink = TRUE;
-  self->keep_aspect_ratio = TRUE;
+  self->content_fit = GTK_CONTENT_FIT_CONTAIN;
 }
 
 /**
@@ -827,21 +880,20 @@ gtk_picture_get_paintable (GtkPicture *self)
  *
  * If set to %FALSE or if the contents provide no aspect ratio,
  * the contents will be stretched over the picture's whole area.
+ *
+ * Deprecated: 4.8: Use [method@Gtk.Picture.set_content_fit] instead. If still
+ *     used, this method will always set the [property@Gtk.Picture:content-fit]
+ *     property to `GTK_CONTENT_FIT_CONTAIN` if @keep_aspect_ratio is true,
+ *     otherwise it will set it to `GTK_CONTENT_FIT_FILL`.
  */
 void
 gtk_picture_set_keep_aspect_ratio (GtkPicture *self,
                                    gboolean    keep_aspect_ratio)
 {
-  g_return_if_fail (GTK_IS_PICTURE (self));
-
-  if (self->keep_aspect_ratio == keep_aspect_ratio)
-    return;
-
-  self->keep_aspect_ratio = keep_aspect_ratio;
-
-  gtk_widget_queue_draw (GTK_WIDGET (self));
-
-  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_KEEP_ASPECT_RATIO]);
+  if (keep_aspect_ratio)
+    gtk_picture_set_content_fit (self, GTK_CONTENT_FIT_CONTAIN);
+  else
+    gtk_picture_set_content_fit (self, GTK_CONTENT_FIT_FILL);
 }
 
 /**
@@ -851,13 +903,17 @@ gtk_picture_set_keep_aspect_ratio (GtkPicture *self,
  * Returns whether the `GtkPicture` preserves its contents aspect ratio.
  *
  * Returns: %TRUE if the self tries to keep the contents' aspect ratio
+ *
+ * Deprecated: 4.8: Use [method@Gtk.Picture.get_content_fit] instead. This will
+ *     now return `FALSE` only if [property@Gtk.Picture:content-fit] is
+ *     `GTK_CONTENT_FIT_FILL`. Returns `TRUE` otherwise.
  */
 gboolean
 gtk_picture_get_keep_aspect_ratio (GtkPicture *self)
 {
   g_return_val_if_fail (GTK_IS_PICTURE (self), TRUE);
 
-  return self->keep_aspect_ratio;
+  return self->content_fit != GTK_CONTENT_FIT_FILL;
 }
 
 /**
@@ -908,6 +964,60 @@ gtk_picture_get_can_shrink (GtkPicture *self)
   return self->can_shrink;
 }
 
+/**
+ * gtk_picture_set_content_fit: (attributes org.gtk.Method.set_property=content-fit)
+ * @self: a `GtkPicture`
+ * @content_fit: the content fit mode
+ *
+ * Sets how the content should be resized to fit the `GtkPicture`.
+ *
+ * See [enum@Gtk.ContentFit] for details.
+ *
+ * If you use `GTK_CONTENT_FIT_COVER`, you may also want to set the
+ * [property@Gtk.Widget:overflow] to `GTK_OVERFLOW_HIDDEN`, otherwise the
+ * paintable will overflow the widget allocation if the aspect ratio of the
+ * paintable is different from the one of the `GtkPicture` allocation.
+ */
+void
+gtk_picture_set_content_fit (GtkPicture    *self,
+                             GtkContentFit  content_fit)
+{
+  g_return_if_fail (GTK_IS_PICTURE (self));
+
+  if (self->content_fit == content_fit)
+    return;
+
+  gboolean notify_keep_aspect_ratio = (content_fit == GTK_CONTENT_FIT_FILL ||
+                                       self->content_fit == GTK_CONTENT_FIT_FILL);
+
+  self->content_fit = content_fit;
+
+  gtk_widget_queue_draw (GTK_WIDGET (self));
+
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CONTENT_FIT]);
+
+  if (notify_keep_aspect_ratio)
+      g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_KEEP_ASPECT_RATIO]);
+}
+
+/**
+ * gtk_picture_get_content_fit: (attributes org.gtk.Method.get_property=content-fit)
+ * @self: a `GtkPicture`
+ *
+ * Returns the fit mode for the content of the `GtkPicture`.
+ *
+ * See [enum@Gtk.ContentFit] for details.
+ *
+ * Returns: the content fit mode
+ */
+GtkContentFit
+gtk_picture_get_content_fit (GtkPicture *self)
+{
+  g_return_val_if_fail (GTK_IS_PICTURE (self), FALSE);
+
+  return self->content_fit;
+}
+
 /**
  * gtk_picture_set_alternative_text: (attributes org.gtk.Method.set_property=alternative-text)
  * @self: a `GtkPicture`
index 80f0334f0e335bbe7f289d026c91981cb2566169..5d6078071d1b63e19805449d2fda3f442123e2f0 100644 (file)
@@ -69,10 +69,10 @@ GDK_AVAILABLE_IN_ALL
 void            gtk_picture_set_pixbuf                  (GtkPicture             *self,
                                                          GdkPixbuf              *pixbuf);
 
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_8_FOR(gtk_picture_set_fit_mode)
 void            gtk_picture_set_keep_aspect_ratio       (GtkPicture             *self,
                                                          gboolean                keep_aspect_ratio);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_8_FOR(gtk_picture_get_fit_mode)
 gboolean        gtk_picture_get_keep_aspect_ratio       (GtkPicture             *self);
 GDK_AVAILABLE_IN_ALL
 void            gtk_picture_set_can_shrink              (GtkPicture             *self,
@@ -80,6 +80,12 @@ void            gtk_picture_set_can_shrink              (GtkPicture
 GDK_AVAILABLE_IN_ALL
 gboolean        gtk_picture_get_can_shrink              (GtkPicture             *self);
 
+GDK_AVAILABLE_IN_4_8
+void            gtk_picture_set_content_fit             (GtkPicture             *self,
+                                                         GtkContentFit           content_fit);
+GDK_AVAILABLE_IN_4_8
+GtkContentFit   gtk_picture_get_content_fit             (GtkPicture             *self);
+
 GDK_AVAILABLE_IN_ALL
 void            gtk_picture_set_alternative_text        (GtkPicture             *self,
                                                          const char             *alternative_text);
index 5826455256f31e9b94261b1887bf5276dcf4995b..3dc3b575c9b857573af06ed0c5ebe13950cd0913 100644 (file)
@@ -9,7 +9,7 @@
         <child type="overlay">
           <object class="GtkPicture">
             <property name="paintable">green-100x100.png</property>
-            <property name="keep-aspect-ratio">0</property>
+            <property name="content-fit">fill</property>
             <property name="can-shrink">1</property>
             <property name="halign">center</property>
             <property name="valign">center</property>
index 2acb5704baa7c3007f06d4137e022e39282cf704..add6cbc520a9994c0cf657b75487691964956f2a 100644 (file)
@@ -7,7 +7,7 @@
     <child>
       <object class="GtkPicture">
         <property name="paintable">green-100x100.png</property>
-        <property name="keep-aspect-ratio">0</property>
+        <property name="content-fit">fill</property>
         <property name="can-shrink">1</property>
         <property name="halign">center</property>
         <property name="valign">center</property>
index 06a17662a32bc2d4c9f962267996383e2dbc2262..df8035707ee46d63d6a353d842df5ee60047ea02 100644 (file)
@@ -9,7 +9,7 @@
         <child type="overlay">
           <object class="GtkPicture">
             <property name="paintable">green-100x100.png</property>
-            <property name="keep-aspect-ratio">0</property>
+            <property name="content-fit">fill</property>
             <property name="can-shrink">1</property>
             <property name="halign">center</property>
             <property name="valign">center</property>
index c5bc7b0882c06be3254c01daa2789a3ce53deea6..5f27966763a012a4862c9c07ce63b4d52664c5b7 100644 (file)
@@ -7,7 +7,7 @@
     <child>
       <object class="GtkPicture">
         <property name="paintable">green-100x100.png</property>
-        <property name="keep-aspect-ratio">0</property>
+        <property name="content-fit">fill</property>
         <property name="can-shrink">1</property>
         <property name="halign">center</property>
         <property name="valign">center</property>
index 9f02233bbdd7d7ed892c01895940e4af47660578..b981c7c188e3088aecc17ea861953d9ac559a3fc 100644 (file)
@@ -9,7 +9,7 @@
         <child type="overlay">
           <object class="GtkPicture">
             <property name="paintable">green-150x150.png</property>
-            <property name="keep-aspect-ratio">0</property>
+            <property name="content-fit">fill</property>
             <property name="can-shrink">1</property>
             <property name="halign">center</property>
             <property name="valign">center</property>
index d7f82955505cefac20a9e91a2c4c0015c3e6a92c..39424049cd2d6cd93a16ff09afc50b69cb5a1732 100644 (file)
@@ -7,7 +7,7 @@
     <child>
       <object class="GtkPicture">
         <property name="paintable">green-150x150.png</property>
-        <property name="keep-aspect-ratio">0</property>
+        <property name="content-fit">fill</property>
         <property name="can-shrink">1</property>
         <property name="halign">center</property>
         <property name="valign">center</property>
index 1213e9249e65e9f9e4a9b0e9a891f9bd69a4c567..767afa24609be4a9c341dc4bd1ca1c87679f1e34 100644 (file)
@@ -9,7 +9,7 @@
         <child type="overlay">
           <object class="GtkPicture">
             <property name="paintable">green-150x150.png</property>
-            <property name="keep-aspect-ratio">0</property>
+            <property name="content-fit">fill</property>
             <property name="can-shrink">1</property>
             <property name="halign">center</property>
             <property name="valign">center</property>
index 3c74776bd30bde6895f1ff94bc2510544359e19b..1a86775400354c1ed7df884bc72a50903122d3e8 100644 (file)
@@ -7,7 +7,7 @@
     <child>
       <object class="GtkPicture">
         <property name="paintable">green-150x150.png</property>
-        <property name="keep-aspect-ratio">0</property>
+        <property name="content-fit">fill</property>
         <property name="can-shrink">1</property>
         <property name="halign">center</property>
         <property name="valign">center</property>
index f15b48b5d551fa2449e49511652060ed4b153b0a..867c973979b42da111a5af553cb092c7d7369a20 100644 (file)
@@ -9,7 +9,7 @@
         <child type="overlay">
           <object class="GtkPicture">
             <property name="paintable">green-200x200.png</property>
-            <property name="keep-aspect-ratio">0</property>
+            <property name="content-fit">fill</property>
             <property name="can-shrink">1</property>
             <property name="halign">center</property>
             <property name="valign">center</property>
index 0f4ead1f8631bb5c2e3456094e978011f3e48878..4c641bbf72c842144ea835033d88391e5e34e44d 100644 (file)
@@ -7,7 +7,7 @@
     <child>
       <object class="GtkPicture">
         <property name="paintable">green-200x200.png</property>
-        <property name="keep-aspect-ratio">0</property>
+        <property name="content-fit">fill</property>
         <property name="can-shrink">1</property>
         <property name="halign">center</property>
         <property name="valign">center</property>
index 6e787008fa97819548980967fbf3f732560ecd5e..4f0e6a4e481cf6c76e6dae9c45f4614a97cddc03 100644 (file)
@@ -9,7 +9,7 @@
         <child type="overlay">
           <object class="GtkPicture">
             <property name="paintable">green-200x200.png</property>
-            <property name="keep-aspect-ratio">0</property>
+            <property name="content-fit">fill</property>
             <property name="can-shrink">1</property>
             <property name="halign">center</property>
             <property name="valign">center</property>
index 82b7b89f4e47bc3d2c74eec94e7de1d0489b098e..ecb9d7be7ca7fde488bc534f21a7fa0eb707755a 100644 (file)
@@ -7,7 +7,7 @@
     <child>
       <object class="GtkPicture">
         <property name="paintable">green-200x200.png</property>
-        <property name="keep-aspect-ratio">0</property>
+        <property name="content-fit">fill</property>
         <property name="can-shrink">1</property>
         <property name="halign">center</property>
         <property name="valign">center</property>
index 55177f2749fd0a82010889c48867e1309cfe15db..34f844d2264f4467b6ffc7cfbb66b14de03f793d 100644 (file)
@@ -9,7 +9,7 @@
         <child type="overlay">
           <object class="GtkPicture">
             <property name="paintable">green-20x20.png</property>
-            <property name="keep-aspect-ratio">0</property>
+            <property name="content-fit">fill</property>
             <property name="can-shrink">1</property>
             <property name="halign">center</property>
             <property name="valign">center</property>
index 80ecb6f2f15a2c3209145739866149e6e1f144c4..b9a0b7bdf57d1583369615481991a931a77657ed 100644 (file)
@@ -7,7 +7,7 @@
     <child>
       <object class="GtkPicture">
         <property name="paintable">green-20x20.png</property>
-        <property name="keep-aspect-ratio">0</property>
+        <property name="content-fit">fill</property>
         <property name="can-shrink">1</property>
         <property name="halign">center</property>
         <property name="valign">center</property>
index e5835423fbf6183d1adcc20fafb43f72bc1153e0..984f304555668ea25b533bb7bea50f77cedda8cb 100644 (file)
@@ -9,7 +9,7 @@
         <child type="overlay">
           <object class="GtkPicture">
             <property name="paintable">green-20x20.png</property>
-            <property name="keep-aspect-ratio">0</property>
+            <property name="content-fit">fill</property>
             <property name="can-shrink">1</property>
             <property name="halign">center</property>
             <property name="valign">center</property>
index 239c68002617ca0843c810505bf877e57eda4337..72e36587add5a54e2657d9f756cf703fba76bac4 100644 (file)
@@ -7,7 +7,7 @@
     <child>
       <object class="GtkPicture">
         <property name="paintable">green-20x20.png</property>
-        <property name="keep-aspect-ratio">0</property>
+        <property name="content-fit">fill</property>
         <property name="can-shrink">1</property>
         <property name="halign">center</property>
         <property name="valign">center</property>
index 2fff2c91d3aaeae8cf1d8e5cecfb77c05195d1d0..41951b220c256ad9c3f8778340cb278ab5a9dc7a 100644 (file)
@@ -9,7 +9,7 @@
         <child type="overlay">
           <object class="GtkPicture">
             <property name="paintable">green-300x300.png</property>
-            <property name="keep-aspect-ratio">0</property>
+            <property name="content-fit">fill</property>
             <property name="can-shrink">1</property>
             <property name="halign">center</property>
             <property name="valign">center</property>
index 12b254670f20f35c186fa9aeacffb3e61314397e..4ca7f384530ff0db71fa393ec0b929a6c4f57915 100644 (file)
@@ -7,7 +7,7 @@
     <child>
       <object class="GtkPicture">
         <property name="paintable">green-300x300.png</property>
-        <property name="keep-aspect-ratio">0</property>
+        <property name="content-fit">fill</property>
         <property name="can-shrink">1</property>
         <property name="halign">center</property>
         <property name="valign">center</property>
index 5c2e1735e68872081f2a5db1089bb37aca784b73..350618202a8b7011b601b741622f5537c7bc4cd8 100644 (file)
@@ -9,7 +9,7 @@
         <child type="overlay">
           <object class="GtkPicture">
             <property name="paintable">green-300x300.png</property>
-            <property name="keep-aspect-ratio">0</property>
+            <property name="content-fit">fill</property>
             <property name="can-shrink">1</property>
             <property name="halign">center</property>
             <property name="valign">center</property>
index 4182b9d82114324a93103f2d50da40368c344d85..14e42ad03e9fbf2157ed4ef914ae6ba6490f503d 100644 (file)
@@ -7,7 +7,7 @@
     <child>
       <object class="GtkPicture">
         <property name="paintable">green-300x300.png</property>
-        <property name="keep-aspect-ratio">0</property>
+        <property name="content-fit">fill</property>
         <property name="can-shrink">1</property>
         <property name="halign">center</property>
         <property name="valign">center</property>